<template>
  <view class="continer">
    <u-toast ref="uToast" />
    <view class="u-text-center tip u-font-15">
      请确认操作结果，确认无误将为您处理分拨
    </view>
    <view class="content">
      <view class="u-border-bottom flex justify-between item align-center">
        <view class=""> 已选终端 </view>
        <view class="color"> {{ size }}台 </view>
      </view>
      <view class="flex justify-between item align-center">
        <view class=""> 分拨对象 </view>
        <view>
          {{ userName }}
        </view>
      </view>
    </view>
    <u-button
      class="u-margin-20 u-margin-top-50"
      type="primary"
      hover-class="false"
      :custom-style="customStyle"
      @click="goAllocate()"
      >确认分拨</u-button
    >
  </view>
</template>

<script>
export default {
  data() {
    return {
      customStyle: {
        // 注意驼峰命名，并且值必须用引号包括，因为这是对象
        backgroundColor: '#9D60FF',
      },
      requstBody: {
        batchNo: '',
        agentNo: '',
        sn: '', // SS00301
      },
      size: '',
      userName: '',
    };
  },
  onLoad(options) {
    console.log('options----->47', options);
    this.requstBody.sn = options.sn;
    this.size = options.size;
    this.requstBody.agentNo = options.agentNo;
    this.userName = options.userName;
  },
  mounted() {
    // this.requstBody.sn = this.$route.query.sn;
    // this.size = this.$route.query.size;
    // this.requstBody.agentNo = this.$route.query.agentNo;
    // this.userName = this.$route.query.userName;
  },
  methods: {
    goAllocate() {
      let _that = this;
      _that.$zx.terminal_api.terminalSNIssue(this.requstBody).then((data) => {
        console.log('terminalSNIssue----->58', data);
        // 分拨成功后提示
        _that.$refs.uToast.show({
          type: 'success',
          title: '操作成功',
          duration: '1000',
        });
        setTimeout(() => {
          uni.navigateBack({
            delta: 3,
          });
        }, 1000);
      });
    },
  },
};
</script>

<style scoped lang="scss">
.tip {
  height: 80rpx;
  line-height: 80rpx;
  background-color: #ffe9ce;
  color: #ffa300;
}

.color {
  color: #9d60ff;
}

.content {
  background-color: white;
  border-radius: 10rpx;
  padding: 0 20rpx;
  margin: 20rpx;

  .item {
    height: 120rpx;
  }
}
</style>
